/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.config.domain;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import com.hera.base.domain.BaseDomain;

/**
 *
 * @author cmontes
 */
@Entity
//nombre personal y de la secuencia en general
//@SequenceGenerator(name="SEC_datasource1", sequenceName="SEC_DATASOURCE")
@Table(name= "DATASOURCE")
public class Datasource extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id 
    @Basic(optional = false) 
    @GeneratedValue(strategy=GenerationType.TABLE, generator="DATASOURCE")
    @TableGenerator(name= "DATASOURCE", table="sequence", pkColumnName="seq_name", valueColumnName="seq_id", pkColumnValue="DATASOURCE", allocationSize = 1 )
    @Column(name = "ID_DATASOURCE")
    private Long idDatasource;
    @Column(name = "JNDI_NAME")
    private String jndiName;
    @Column(name = "SCHEMA")
    private String schema;
  /*  @OneToMany(mappedBy = "datasource")
    private List<AdditionalTable> additionalTableList;*/

    public Datasource() {
    }

    public Datasource(Long idDatasource) {
        this.idDatasource = idDatasource;
    }

    public Long getIdDatasource() {
        return idDatasource;
    }

    public void setIdDatasource(Long idDatasource) {
        this.idDatasource = idDatasource;
    }

    public String getJndiName() {
        return jndiName;
    }

    public void setJndiName(String jndiName) {
        this.jndiName = jndiName;
    }

    public String getSchema() {
        return schema;
    }

    public void setSchema(String schema) {
        this.schema = schema;
    }

  /*  public List<AdditionalTable> getAdditionalTableList() {
        return additionalTableList;
    }

    public void setAdditionalTableList(List<AdditionalTable> additionalTableList) {
        this.additionalTableList = additionalTableList;
    }*/

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDatasource != null ? idDatasource.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof Datasource)) {
            return false;
        }
        Datasource other = (Datasource) object;
        if ((this.idDatasource == null && other.idDatasource != null) || (this.idDatasource != null && !this.idDatasource.equals(other.idDatasource))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.Datasource[ idDatasource=" + idDatasource + " ]";
    }
    
}
